Autocomplete, DropDownButton, DropDownBox: Refactor and improve typing#33784
Autocomplete, DropDownButton, DropDownBox: Refactor and improve typing#33784vorobey wants to merge 16 commits into
Conversation
7f2364e to
4cfdc31
Compare
d981be3 to
3fc9002
Compare
There was a problem hiding this comment.
Pull request overview
This PR refactors internal implementations and public typings around DropDownButton / DropDownBox / Autocomplete and Overlay to reduce @ts-expect-error usage and better reflect runtime behavior (e.g., allowing null templates and function-valued hideOnParentScroll) across core, Angular, React, and Vue wrappers.
Changes:
- Updated public
.d.tstypings for nullable templates/selection (null) andhideOnParentScrollasboolean | (() => boolean). - Refactored internal DropDownButton/DropDownBox/Autocomplete code to use more explicit types and fewer
@ts-expect-errorsuppressions. - Propagated updated option typings into Angular/React/Vue wrapper prop/input/output definitions.
Reviewed changes
Copilot reviewed 55 out of 58 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/devextreme/ts/dx.all.d.ts | Aligns bundled typings with nullable templates/selection and functional hideOnParentScroll. |
| packages/devextreme/js/ui/overlay.d.ts | Updates dxOverlayOptions typing for contentTemplate nullability and functional hideOnParentScroll. |
| packages/devextreme/js/ui/drop_down_button.d.ts | Improves DropDownButton option typing (nullable selection/template) and removes some default doc tags. |
| packages/devextreme/js/__internal/ui/radio_group/radio_group.ts | Removes a @ts-expect-error comment in option forwarding. |
| packages/devextreme/js/__internal/ui/m_tag_box.ts | Removes several @ts-expect-error comments around value/display handling. |
| packages/devextreme/js/__internal/ui/m_select_box.ts | Adds/adjusts explicit return types and removes @ts-expect-error comments around display getter usage. |
| packages/devextreme/js/__internal/ui/m_drop_down_button.ts | Large refactor to tighten typing, reduce suppressions, and adjust popup/list wiring and ARIA updates. |
| packages/devextreme/js/__internal/ui/m_drop_down_box.ts | Refactors typing around DataExpressionMixin usage and popup behaviors; replaces imports and removes suppressions. |
| packages/devextreme/js/__internal/ui/m_autocomplete.ts | Refactors typings/events and list configuration; replaces some imports and adds explicit signatures. |
| packages/devextreme/js/__internal/ui/drop_down_editor/drop_down_list.ts | Adds DataExpressionMixin workaround typings and removes some suppressions; adjusts display-value helper. |
| packages/devextreme/js/__internal/ui/drop_down_editor/drop_down_editor.ts | Adjusts @ts-expect-error placement for popup options typing. |
| packages/devextreme/js/__internal/events/utils/index.ts | Minor defensive typing change (e?.type) for wheel event detection. |
| packages/devextreme/js/__internal/data/data_controller/data_controller.ts | Exposes DataSourceType and loosens updateDataSource parameter optionality. |
| packages/devextreme/js/__internal/core/widget/widget.ts | Small cleanup (onKeyboardHandled?.(...)) and refines _setWidgetOption typing. |
| packages/devextreme-vue/src/tree-list.ts | Updates wrapper prop typing for functional hideOnParentScroll. |
| packages/devextreme-vue/src/toast.ts | Updates wrapper prop typing for functional hideOnParentScroll. |
| packages/devextreme-vue/src/tag-box.ts | Updates wrapper prop typing for functional hideOnParentScroll. |
| packages/devextreme-vue/src/select-box.ts | Updates wrapper prop typing for functional hideOnParentScroll. |
| packages/devextreme-vue/src/popup.ts | Updates wrapper prop typing for functional hideOnParentScroll. |
| packages/devextreme-vue/src/load-panel.ts | Updates wrapper prop typing for functional hideOnParentScroll. |
| packages/devextreme-vue/src/drop-down-button.ts | Updates selectedItemKey to allow null and updates hideOnParentScroll typing. |
| packages/devextreme-vue/src/drop-down-box.ts | Updates wrapper prop typing for functional hideOnParentScroll. |
| packages/devextreme-vue/src/date-range-box.ts | Updates wrapper prop typing for functional hideOnParentScroll. |
| packages/devextreme-vue/src/date-box.ts | Updates wrapper prop typing for functional hideOnParentScroll. |
| packages/devextreme-vue/src/data-grid.ts | Updates wrapper prop typing for functional hideOnParentScroll. |
| packages/devextreme-vue/src/color-box.ts | Updates wrapper prop typing for functional hideOnParentScroll. |
| packages/devextreme-vue/src/card-view.ts | Updates wrapper prop typing for functional hideOnParentScroll. |
| packages/devextreme-vue/src/autocomplete.ts | Updates wrapper prop typing for functional hideOnParentScroll. |
| packages/devextreme-react/src/tree-list.ts | Updates wrapper prop typing for nullable contentTemplate and functional hideOnParentScroll. |
| packages/devextreme-react/src/tag-box.ts | Updates wrapper prop typing for nullable contentTemplate and functional hideOnParentScroll. |
| packages/devextreme-react/src/select-box.ts | Updates wrapper prop typing for nullable contentTemplate and functional hideOnParentScroll. |
| packages/devextreme-react/src/lookup.ts | Updates wrapper prop typing for nullable contentTemplate. |
| packages/devextreme-react/src/drop-down-button.ts | Updates wrapper prop typing for nullable contentTemplate and functional hideOnParentScroll. |
| packages/devextreme-react/src/drop-down-box.ts | Updates wrapper prop typing for nullable contentTemplate and functional hideOnParentScroll. |
| packages/devextreme-react/src/date-range-box.ts | Updates wrapper prop typing for nullable contentTemplate and functional hideOnParentScroll. |
| packages/devextreme-react/src/date-box.ts | Updates wrapper prop typing for nullable contentTemplate and functional hideOnParentScroll. |
| packages/devextreme-react/src/data-grid.ts | Updates wrapper prop typing for nullable contentTemplate and functional hideOnParentScroll. |
| packages/devextreme-react/src/color-box.ts | Updates wrapper prop typing for nullable contentTemplate and functional hideOnParentScroll. |
| packages/devextreme-react/src/card-view.ts | Updates wrapper prop typing for functional hideOnParentScroll. |
| packages/devextreme-react/src/autocomplete.ts | Updates wrapper prop typing for nullable contentTemplate and functional hideOnParentScroll. |
| packages/devextreme-angular/src/ui/tree-list/nested/popup.ts | Updates Angular input typing for functional hideOnParentScroll. |
| packages/devextreme-angular/src/ui/tree-list/nested/filter-builder-popup.ts | Updates Angular input typing for functional hideOnParentScroll. |
| packages/devextreme-angular/src/ui/toast/index.ts | Updates Angular input/output typing for functional hideOnParentScroll. |
| packages/devextreme-angular/src/ui/tag-box/nested/drop-down-options.ts | Updates Angular input typing for functional hideOnParentScroll. |
| packages/devextreme-angular/src/ui/select-box/nested/drop-down-options.ts | Updates Angular input typing for functional hideOnParentScroll. |
| packages/devextreme-angular/src/ui/popup/component.ts | Updates Angular input/output typing for functional hideOnParentScroll. |
| packages/devextreme-angular/src/ui/nested/base/popup-options.ts | Updates base nested popup options typing (notably contentTemplate / hideOnParentScroll). |
| packages/devextreme-angular/src/ui/load-panel/index.ts | Updates Angular input/output typing for functional hideOnParentScroll. |
| packages/devextreme-angular/src/ui/drop-down-button/nested/drop-down-options.ts | Updates Angular nested dropdown option typing for functional hideOnParentScroll. |
| packages/devextreme-angular/src/ui/drop-down-button/index.ts | Updates Angular input/output typing for nullable selection and selectedItemKey nullability. |
| packages/devextreme-angular/src/ui/drop-down-box/nested/drop-down-options.ts | Updates Angular nested dropdown option typing for functional hideOnParentScroll. |
| packages/devextreme-angular/src/ui/date-range-box/nested/drop-down-options.ts | Updates Angular nested dropdown option typing for functional hideOnParentScroll. |
| packages/devextreme-angular/src/ui/date-box/nested/drop-down-options.ts | Updates Angular nested dropdown option typing for functional hideOnParentScroll. |
| packages/devextreme-angular/src/ui/data-grid/nested/popup.ts | Updates Angular nested popup option typing for functional hideOnParentScroll. |
| packages/devextreme-angular/src/ui/data-grid/nested/filter-builder-popup.ts | Updates Angular nested popup option typing for functional hideOnParentScroll. |
| packages/devextreme-angular/src/ui/color-box/nested/drop-down-options.ts | Updates Angular nested dropdown option typing for functional hideOnParentScroll. |
| packages/devextreme-angular/src/ui/card-view/nested/load-panel.ts | Updates Angular nested load panel option typing for functional hideOnParentScroll. |
| packages/devextreme-angular/src/ui/autocomplete/nested/drop-down-options.ts | Updates Angular nested dropdown option typing for functional hideOnParentScroll. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Andrey Vorobev <dobriy.kaa@gmail.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Andrey Vorobev <dobriy.kaa@gmail.com>
…declare for dataexpressionmixin
| downArrow(e): boolean { | ||
| // @ts-expect-error ts-error | ||
| if (parent.downArrow.apply(this, arguments) && !isCommandKeyPressed(e)) { | ||
| downArrow: (e): boolean => { |
There was a problem hiding this comment.
Is there any reason to convert the method to an arrow function? The original implementation relied on dynamic this binding and forwarded all arguments via apply(this, arguments). The new version changes both behaviors (arguments -> e which is correct, method -> arrow function), so it may not be fully equivalent.
There was a problem hiding this comment.
main reason was to fix using "arguments", i removed arrows, but have kept call instead of apply, because we only use e here
No description provided.